import {
    get,
    post,
    del,
    put,
    patch
} from '@/plugins/axios'


export const login = (params, headers) => post("/login.php?action=read", params, headers)
export const registered = (params, headers) => post("/login.php?action=create", params, headers)
export const createQuestionnaire = (params, headers) => post("/create.php", params, headers)
export const is_recycle = (params, headers) => post("/is_recycle.php", params, headers)
export const remove = (params, headers) => post("/remove.php", params, headers)
export const getQlist = (params, headers) => post("/getQlist.php", params, headers)
export const cover = (params, headers) => post("/cover.php", params, headers)
export const delQuestion = (params, headers) => post("/del.php", params, headers)
export const issue = (params, headers) => post("/issue.php", params, headers)
export const statistical = (params, headers) => post("/statistical.php", params, headers)
export const getStatistical = (params, headers) => post("/getStatistical.php", params, headers)
// >>>>>>>>>>>>>>>>>>>>> Model realated API HERE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

// 仅包含问卷信息，不包含问卷问题的新建
export const putSurveyListAPI = (params, headers) => put("api/surveys/survey", params, headers)
export const getSurveyListAPI = (params, headers) => get("api/surveys/survey", params, headers)
export const patchSurveyListAPI = (sid, params, headers) => patch("api/surveys/survey/" + sid, params, headers)


// 包含问卷下详细问题的新建。虽然应该基本不用。是否违背Restful命名理念？？
export const putSurveyAPI = (params, headers) => get("api/surveys/survey-detail", params, headers)
export const getSurveyAPI = (sid, params, headers) => get("api/surveys/survey-detail/" + sid, params, headers)
export const patchSurveyAPI = (sid, params, headers) => patch("api/surveys/survey-detail/" + sid, params, headers)
export const postSurveyAPI = (params, headers) => get("api/surveys/survey-detail", params, headers)
export const deleteSurveyAPI = (sid, headers) => del('api/surveys/survey/' + sid, headers)

export const getSurveyAnswerAPI = (sid, params, headers) => get("api/surveys/survey-answer/" + sid, params, headers)
export const putAnswerAPI = (sid, params, headers) => put("api/surveys/" + sid + "/answers", params, headers)
export const patchAnswerAPI = (sid, params, headers) => patch("api/surveys/" + sid + "/answers", params, headers)

export const getQuestionAPI = (params, headers) => get("api/surveys/survey-detail", params, headers)
export const putQuestionAPI = (sid, params, headers) => put("api/surveys/survey/" + sid + "/questions", params, headers)
export const patchQuestionAPI = (qid, params, headers) => patch("api/surveys/question/" + qid, params, headers)
export const delQuestionAPI = (qid, params, headers) => del("api/surveys/question/" + qid, params, headers)

export const getStudentListAPI = (params, headers) => get("api/admin/student-list", params, headers)
export const putStudentListAPI = (params, headers) => put("api/admin/student-list", params, headers)

export const getAcademyListAPI = (params, headers) => get("api/admin/academy-list", params, headers)
export const putAcademyListAPI = (params, headers) => put("api/admin/academy-list", params, headers)
export const postAcademyAPI = (aid, params, headers) => post("api/admin/academy/" + aid, params, headers)
export const delAcademyAPI = (aid, params, headers) => del("api/admin/academy/" + aid, params, headers)

export const getMajorListAPI = (params, headers) => get("api/admin/major-list", params, headers)
export const putMajorListAPI = (params, headers) => put("api/admin/major-list", params, headers)
export const postMajorAPI = (aid, params, headers) => post("api/admin/major/" + aid, params, headers)
export const delMajorAPI = (aid, params, headers) => del("api/admin/major/" + aid, params, headers)

export const getSurveyList = (params, headers) => get("api/survey", params, headers)

export const getSurveyDetail = (sid, params, headers) => get('api/survey/' + sid, params, headers)

export const getAnswerData = (sid, params, headers) => get('api/survey/' + sid + '/answers-list', params, headers)

export const getAnswerStatAPI = (sid, params, headers) => get('api/survey/' + sid + '/answers-stat', params, headers)